package plus;
import plus.decl.*;
public class TS_Record extends TypeSym {
	Template tpl;
	public int arity() { return tpl.arity(); }
	private boolean mayNil;
	public TS_Record(Template tpl, boolean mayNil) {
		this.tpl = tpl;
		this.mayNil = mayNil;
	}
	public Struct struct;
	public boolean isNullable() { return mayNil; } // Leaving open the possibility of a non-null record.
	Type typeOfField(String name, Type[] actuals) { Gripe.context = this; return struct.typeOf(name, actuals); }
	@Override public Type constructWith(Type[] actuals) {
		if (actuals == null) actuals = Type.fresh_vars(arity());
		else if (actuals.length != arity()) throw new Gripe("Wrong number of parameters for "+this);
		return Type.fresh(new S_Record(this, actuals));
	}
	@Override public String toString() { return tpl.toString(); }
}
